package se.webbzon.boltzmann.game.object.dialogue;

import se.webbzon.boltzmann.sound.SoundUtils;

public enum DialogueVoice {
	
	none((String[]) null), 
	normal("character_speak_01","character_speak_02"), 
	aggressive("character_speak_03","character_speak_04");
	
	private final String[] sounds;
	
	/*============================================================
	Constructors
	============================================================*/
	
	private DialogueVoice(String...sounds) {
		this.sounds = sounds;
	}
	
	/*============================================================
	Public Methods
	============================================================*/
	
	/** Returns the number of sounds associated with this voice. **/
	public int sounds() {
		if (sounds == null)
			return 0;
		else
			return sounds.length;
	}
	
	/** Plays the (n+1):th sound of this voice. **/
	public void playSound(int n) {
		SoundUtils.playSound(sounds[n]);
	}
	
	/** Plays a random sound of this voice. **/
	public void playRandom() {
		int nrOfSounds = sounds();
		if (nrOfSounds > 0) {
			int n = (int) (nrOfSounds * Math.random());
			playSound(n);
		}
	}

}
